import 'package:OASys/components/TabBarWidget.dart';
import 'package:OASys/views/event/eventCheck.dart';
import 'package:OASys/views/event/myEvent.dart';
import 'package:flutter/material.dart';

class EventPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MyEventPage();
  }
}

class MyEventPage extends StatefulWidget {
  @override
  _MyEventPageState createState() => _MyEventPageState();
}

class _MyEventPageState extends State<MyEventPage> {
  @override
  Widget build(BuildContext context) {
    List<Widget> tabs = [
      _renderTab(Text("需审核流程")),
      _renderTab(Text("已审核流程")),
      _renderTab(Text("我的流程")),
    ];
    //一个控件，可以监听返回键
    return TabBarWidget(
      title: Text("流程管理"),
      type: TabBarWidget.TOP_TAB,
      tabItems: tabs,
      tabViews: [EventCheck(0), EventCheck(1), MyEvent()],
      backgroundColor: Theme.of(context).primaryColor,
      indicatorColor: Theme.of(context).indicatorColor,
    );
  }

  _renderTab(text) {
    //返回一个标签
    return new Tab(
        child: new Container(
      //设置paddingTop为6
      padding: new EdgeInsets.only(top: 6),
      //一个列控件
      child: new Column(
        //竖直方向居中
        mainAxisAlignment: MainAxisAlignment.center,
        //水平方向居中
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[text],
      ),
    ));
  }
}
